﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<title>欢迎光临 Music Store</title>
<script src="script/jquery.validate.min.js"></script>
<script src="script/messages_zh.js"></script>
<script src="script/jquery.metadata.js"></script>
<script>
$(function(){
	$.validator.setDefaults({
	    submitHandler: function() {
	    	$("#register").submit();
	    }
	});
	$("#register").validate();
	$("#username").blur(function(){
		$.get("check",{username:$(this).val()},function(data){
			var bool=eval(data);
			if(bool){
				$("#msg").html("名字已经被占用");
			}
			
		});
	});
	 
});
</script>

<h3 id="main-title">用户注册</h3>
<form id="register" action="registers" method="post">
	<table>
		<tr>
			<td>用户名：</td>
			<td><input type="text" id="username" name="userName" required
				minlength="2" /> <span id="msg" style="color: red;"> </span></td>
		</tr>
		<tr>
			<td>密码：</td>
			<td><input type="password" id="password" name="passWord"
				required minlength="11" /></td>
		</tr>
		<tr>
			<td>密码确认：</td>
			<td><input type="password" id="passwordAgain"
				name="passwordAgain" required minlength="11" equalTo='#passWord' />
			</td>
		</tr>
		<tr>
			<td>姓名：</td>
			<td><input type="text" id="name" name="name" required /></td>
		</tr>
		<tr>
			<td>地址：</td>
			<td><input type="text" id="address" name="address" required />
			</td>
		</tr>
		<tr>
			<td>电话：</td>
			<td><input type="text" id="phone" name="phone" required number />
			</td>
		</tr>
		<tr>
			<td>Email：</td>
			<td><input type="email" id="email" name="email" email required />
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input id="btnSubmit" type="submit" name="btnSubmit"
				value="注册" /></td>
			<td>${error }</td>
		</tr>
		<tr>
			<td colspan="2"></td>
		</tr>
	</table>
</form>
